<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class GroupController extends HomeController
{

	//系统首页
    public function index()
    {
		
		
		$document=D('Document');
		
		$carousel = new \Document\Model\Carousel\Home\GetGroupCarouselModel();
		$group_carousel= $carousel->get();
	
		
		
		$this->assign('group_carousel', $group_carousel);
        $this->display('group');
    }
	
	 public function submit()
    {
				$group_content['user_name']=I('post.user_name');
				$group_content['user_phone']=I('post.user_phone');
				$group_content['remarks']=I('post.remarks');
				$group_content['group_time']=strtotime(I('post.group_time'));
				$group_content['title']=I('post.title',0);
		
		if(!empty($_POST) && $group_content['group_time']!=null){
			$document=D('Document');
			$data['category_id']='58';
			$data['model_id']='12';
			$data['status']='1';
			$data['title']=I('post.title',0);
			$data['create_time']=strtotime(date("Y-m-d H:i:s"));
			$data['update_time']=strtotime(date("Y-m-d H:i:s"));
			
			$return=$document->add($data);
				
			if($return){
				$group=D('DocumentGroup');
			
				$group_content['id']=$return;
				$group_id=$group->add($group_content);
				if($group_id){
					$this->success('提交成功！');
				}
			}
		}else{
			$this->error('请完善数据！');
		}
	
	}
}